|
RAIS
3.2
|
00001 00028 using System; 00029 using System.Data; 00030 using System.Configuration; 00031 using System.Collections; 00032 using System.Collections.Generic; 00033 using System.Web; 00034 using System.Web.Security; 00035 using System.Web.UI; 00036 using System.Web.UI.WebControls; 00037 using System.Web.UI.WebControls.WebParts; 00038 using System.Web.UI.HtmlControls; 00039 00040 using RAIS.ApplicationLogicLayer; 00041 using RAIS.Common.UserManagement; 00042 00043 using FunctionRoles = System.Collections.Generic.Dictionary<string, RAIS.Common.UserManagement.FunctionRole>; 00044 using DataRoles = System.Collections.Generic.Dictionary<string, RAIS.Common.UserManagement.DataRole>; 00045 using Facilities = System.Collections.Generic.Dictionary<string, RAIS.Common.UserManagement.Facility>; 00046 using UserTypes = System.Collections.Generic.Dictionary<string, RAIS.Common.UserManagement.UserTypeData>; 00047 00048 namespace RAIS.UI.SpecificMasks 00049 { 00053 public partial class UserStatus : System.Web.UI.Page 00054 { 00058 enum User_PageMode 00059 { 00060 viewUser, 00061 addUser, 00062 editUser 00063 }; 00064 //********************************************************************* 00065 #region Properties 00066 00069 private UserData SelectedUser 00070 { 00071 get 00072 { 00073 return (UserData)this.Session[UI.Common.Constants.SELECTED_USER_TAG]; 00074 } 00075 } 00079 private User_PageMode CurrentUser_PageMode 00080 { 00081 get 00082 { 00083 if (this.Session[UI.Common.Constants.ADD_EDIT_USER_PAGE_MODE_TAG] != null) 00084 { 00085 return (User_PageMode)this.Session[UI.Common.Constants.ADD_EDIT_USER_PAGE_MODE_TAG]; 00086 } 00087 else 00088 return User_PageMode.viewUser; 00089 } 00090 set 00091 { 00092 string message; 00093 switch (value) 00094 { 00095 case User_PageMode.addUser: message = RAIS.Common.Messages.ADDING_NEW_USER; break; 00096 case User_PageMode.editUser: message = RAIS.Common.Messages.EDITTING_EXISTING_USER; break; 00097 default: message = ""; break; 00098 } 00099 RAIS.UI.Common.MessageDisplay.DisplayReturnMessage(this.LBLresult, message, true); 00100 this.Session[UI.Common.Constants.ADD_EDIT_USER_PAGE_MODE_TAG] = value; 00101 } 00102 } 00106 protected UserData CurrentUser 00107 { 00108 get { return (UserData)this.Session[UI.Common.Constants.CURRENT_USER_TAG]; } 00109 } 00113 protected int UserID 00114 { 00115 get 00116 { 00117 return (Request[RAIS.UI.Common.Constants.USER_ID_PARAMETER_NAME] == null) 00118 ? 0 00119 : int.Parse(Request[RAIS.UI.Common.Constants.USER_ID_PARAMETER_NAME]); 00120 } 00121 } 00125 protected string SelectedStatus 00126 { 00127 get 00128 { 00129 Dictionary<string, string> userStatuses = UI.Common.UserManagement.GetUserStatusesHistoryByUser(this, this.SelectedUser, false); 00130 if (userStatuses.ContainsKey(LBuserStatus.SelectedValue)) 00131 return userStatuses[LBuserStatus.SelectedValue]; 00132 else 00133 return string.Empty; 00134 } 00135 } 00136 #endregion 00137 //********************************************************************* 00138 #region Event handlers 00139 protected void Page_PreLoad(object sender, EventArgs e) 00140 { 00141 RAIS.UI.Common.PageManagement.TrimTextBoxValues(this); 00142 } 00149 protected void Page_Load(object sender, EventArgs e) 00150 { 00151 this.Response.Cache.SetNoStore(); 00152 if (this.CurrentUser == null) 00153 UI.Common.AccessManagement.SignOut(this); 00154 00155 this.LBLresult.Text = string.Empty; 00156 if (!this.IsPostBack) 00157 { 00158 this.LBLusernameNoTranslation.Text = this.CurrentUser.Name; 00159 this.LBLadmin.ForeColor = RAIS.UI.Common.Constants.COLOR_OF_MENU_BAR_TEXT_HIGHLIGHT; 00160 UI.Common.UserManagement.InitializeUserStatusesListBox(this.LBuserStatus, this.SelectedUser); 00161 if (this.LBuserStatus.Items.Count != 0) 00162 this.LBuserStatus.SelectedIndex = 0; 00163 00164 UI.Common.PageManagement.InitializePage(this, this.TreeView1); 00165 // this.LBTNmessagebox.Visible = !(this.CurrentUser.FunctionalRole.Type == FunctionRole.FunctionRoleType.Guest); 00166 00167 this.CurrentUser_PageMode = User_PageMode.viewUser; 00168 00169 this.ShowUserStatus(); 00170 } 00171 UI.Common.PageManagement.InitHelpMainMenu(LBTNdefault); 00172 } 00173 protected void Page_Init(object sender, EventArgs e) 00174 { 00175 Common.PageManagement.SetScrolableListBox(LBuserStatus, this, true); 00176 } 00183 protected void LNKaddEditUser_Click(object sender, EventArgs e) 00184 { 00185 //this.Session[RAIS.UI.Common.Constants.RELEASE_REJECT_SUBMODE_TAG] = false; 00186 this.Response.Redirect(string.Format("~/AddEditUsers_New.aspx?id={0}" 00187 , this.SelectedUser.ID)); 00188 } 00195 protected void LBuserStatus_SelectedIndexChanged(object sender, EventArgs e) 00196 { 00197 this.ShowUserStatus(); 00198 } 00205 protected void LBTNlogout_Click(object sender, EventArgs e) 00206 { 00207 UI.Common.AccessManagement.SignOut(this); 00208 } 00215 protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e) 00216 { 00217 UI.Common.UserManagement.ProcessTreeViewOnRedirect(this.TreeView1); 00218 } 00219 #endregion 00220 //********************************************************************* 00221 #region Private helper methods 00222 00228 void ShowUserStatus() 00229 { 00230 this.TXTeuusername.Text = this.SelectedUser.Name; 00231 this.TXTstatusDate.Text = this.LBuserStatus.SelectedValue; 00232 this.TXTuserStatus.Text = this.SelectedStatus; 00233 } 00234 #endregion 00235 } 00236 }